home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 5 / BBS in a Box -Volume V (BBS in a Box) (April 1992).iso / Files / Tele / S / SmartClone.3.cpt / SmartClone 0.3.rsrc / STR#_1003.txt < prev    next >
Encoding:
Text File  |  1988-08-22  |  4.2 KB  |  195 lines

  1. SERVICE:               COMMAND KEY: H
  2.  
  3. ' Make sure there's a modem file
  4.  
  5. IF (@modemFile = "") OR (NOT Exists%(ServiceFPath & @modemFile)) THEN ‚àÇ
  6.  
  7.     GOSUB getModemFile
  8.  
  9. ' Log off if service was set
  10.  
  11. IF Service <> "" THEN DOLOGOFF:IF ResultCode% = 0 THEN END
  12.  
  13. ' If log off succeeds then end, else hang up
  14.  
  15. DO FILE @modemFile "hangUp"
  16.  
  17. IF ResultCode% <> 0 THEN ‚àÇ
  18.  
  19.    badFile = @modemFile: ‚àÇ
  20.  
  21.    badLabel = "HangUp": ‚àÇ
  22.  
  23.    GOSUB doFileError: ‚àÇ
  24.  
  25.    END
  26.  
  27. IF Remark = "" THEN Remark = "MiniTerminal"
  28.  
  29. JOURNALIZE
  30.  
  31. Remark = ""
  32.  
  33. TIMER RESET
  34.  
  35. END
  36.  
  37.  
  38.  
  39. getModemFile: 'gets name of modem file and stores it in variable @modemFile
  40.  
  41.     prompt1 = "You are attempting to hang up without a modem file.  Please find the modem file."
  42.  
  43. getModemFile2:
  44.  
  45.     fileType1 = "SERV"
  46.  
  47.     HOLD OFF
  48.  
  49.     modemFile = GetFile(prompt1,fileType1,ServiceFPath)
  50.  
  51.     IF (ResultCode% = 100) OR (DBoxResult% = CANCEL%) THEN END                      ' user gave up, end
  52.  
  53.     HOLD ON
  54.  
  55.     CURSOR WATCH
  56.  
  57.     'parse the path from string returned by GetFile
  58.  
  59.     myPath = modemFile
  60.  
  61.     lastColon% = 0
  62.  
  63. getLastColon:           ' find the last colon before the file name
  64.  
  65.     IF InStr%(lastColon%+1, myPath, ":") <> 0 THEN ‚àÇ
  66.  
  67.         lastColon% = lastColon%+1: GOTO getLastColon
  68.  
  69.     myPath = Left(myPath,lastColon%)
  70.  
  71.     modemFile = Mid(modemFile, lastColon%+1)   ' modemFile is now file name
  72.  
  73.     ServiceFPath = myPath   ' set ServiceFPath to path returned by GetFile
  74.  
  75.     Message = ""            ' "Identify" sets message
  76.  
  77.     DO FILE modemFile "Identify"
  78.  
  79.     IF (ResultCode% <> 0) THEN ‚àÇ
  80.  
  81.         IF (ResultCode% <> 106) THEN ‚àÇ          ' bad label error
  82.  
  83.             badFile = modemFile: ‚àÇ              ' 106 is "label not found" error
  84.  
  85.             badLabel = "Identify": ‚àÇ
  86.  
  87.             GOSUB doFileError: ‚àÇ
  88.  
  89.             CURSOR RESET: ‚àÇ
  90.  
  91.             END ‚àÇ
  92.  
  93.         ELSE Message = "NotModem"               ' coerce dbox for error #106
  94.  
  95.     IF UpCase(Message) <> "MODEM" THEN ‚àÇ        ' modemFile is not a modem file
  96.  
  97.         DBoxSay = modemFile & " does not appear to be a modem file.  " & ‚àÇ
  98.  
  99.             "This program cannot hang up without a  modem file.  " & ‚àÇ
  100.  
  101.             "An example of a modem file for Apple and " & ‚àÇ
  102.  
  103.             "Hayes-compatible modems is ""Hayes Modem.""  Try again?": ‚àÇ
  104.  
  105.         HOLD OFF: ‚àÇ
  106.  
  107.         DBOX 2: ‚àÇ
  108.  
  109.         IF DBoxResult% = OK% THEN HOLD ON:GOTO getModemFile ‚àÇ
  110.  
  111.         ELSE END                                ' user gave up, end
  112.  
  113.     ' check to see if modem file in Lookup Table is still there
  114.  
  115.     IF @modemFile <> "" THEN ‚àÇ
  116.  
  117.         IF NOT Exists%(ServiceFPath & @modemFile) THEN CLEAR @modemFile ‚àÇ
  118.  
  119.         ELSE ‚àÇ
  120.  
  121.             DO FILE @modemFile "ClearTable": ‚àÇ
  122.  
  123.             IF ResultCode% <> 0 THEN ‚àÇ          ' check for "DO FILE" error
  124.  
  125.                 badFile = @modemFile: ‚àÇ
  126.  
  127.                 badLabel =  "ClearTable": ‚àÇ
  128.  
  129.                 GOSUB doFileError: ‚àÇ
  130.  
  131.                 END
  132.  
  133.     @modemFile = modemFile                      ' put modem file in lookup table
  134.  
  135.     RETURN
  136.  
  137.  
  138.  
  139. doFIleError:    ' puts up error dialog and aborts
  140.  
  141.  
  142.  
  143.     HOLD OFF
  144.  
  145.     BELL:BELL   ' alert user
  146.  
  147.     ' Give user a description of error
  148.  
  149.     IF ResultCode% = 106 THEN DBoxSay = "Cannot find the label """ & badLabel & ‚àÇ
  150.  
  151.         """ in the file """ & badFile & """.  Program aborted." ‚àÇ
  152.  
  153.     ELSE IF ResultCode% = -108 THEN ‚àÇ
  154.  
  155.         DBoxSay = "Not enough memory to open the file """ & ‚àÇ
  156.  
  157.         badFile & """.  Program aborted." ‚àÇ
  158.  
  159.     ELSE IF ResultCode% = -35 THEN ‚àÇ
  160.  
  161.         DBoxSay = "Cannot open the file """ & badFile & ‚àÇ
  162.  
  163.         """ because volume specified doesn't exist.  Program aborted." ‚àÇ
  164.  
  165.     ELSE IF ResultCode% = -49 THEN ‚àÇ
  166.  
  167.         DBoxSay = "Cannot open the file """ & badFile & ‚àÇ
  168.  
  169.         """ because it is already open for writing.  Program aborted." ‚àÇ
  170.  
  171.     ELSE IF ResultCode% = -47 THEN ‚àÇ
  172.  
  173.         DBoxSay = "Cannot open the file """ & badFile & ‚àÇ
  174.  
  175.         """ because it is busy.  Program aborted." ‚àÇ
  176.  
  177.     ELSE DBoxSay = "The following error occurred during a call to """ & badLabel & ‚àÇ
  178.  
  179.         """ in the file """ & badFile & """:  Macintosh error result code = " & ‚àÇ
  180.  
  181.         ResultCode% & ".  Program aborted."
  182.  
  183.     DBOX 1
  184.  
  185.     RETURN
  186.  
  187.  
  188.  
  189. Interrupt:
  190.  
  191.     DISPLAY "^M^JWait for hang up to finish."
  192.  
  193.     RETURN
  194.  
  195.